JsMap

public interface JsMap implements JsObject

A JavaScript map.

A map object can be passed between Java and JavaScript as a method argument or a return value. The object lifetime is bound to the lifetime of the frame this object belongs to. When the owner frame is unloaded, all the JavaScript objects are automatically disposed.

An attempt to access a disposed JavaScript object will result in IllegalStateException.

Since

7.20

Functions

Link copied to clipboard
public abstract T call<T>(String methodName, Array<Object> args)
Executes the function with the given methodName and the args in the JavaScript object.
Link copied to clipboard
public abstract void clear()
Removes all elements from this map.
Link copied to clipboard
public abstract void close()
Closes this JavaScript object.
Link copied to clipboard
public abstract boolean delete(Object key)
Removes the mapping for the specified key from this map.
Link copied to clipboard
public abstract Frame frame()
Returns the Frame instance of this JavaScript object.
Link copied to clipboard
public abstract T get<T>(Object key)
Returns the value associated with the specified key or an empty Optional if there is no such key in this map.
Link copied to clipboard
public abstract boolean has(Object key)
Returns true if this map contains a mapping for the specified key.
Link copied to clipboard
public abstract boolean hasProperty(String name)
Checks whether this JavaScript object or any of its prototypes has an enumerable property with the given name.
Link copied to clipboard
public abstract List<String> ownPropertyNames()
Returns an immutable list of the names of the properties of this JavaScript object, both enumerable and non-enumerable, excluding the properties from the prototype objects.
Link copied to clipboard
public abstract Optional<T> property<T>(String name)
Returns an Optional describing the value of the JavaScript object's property with the given name or an empty Optional if there is no such property or its value is undefined.
Link copied to clipboard
public abstract List<String> propertyNames()
Returns an immutable list of the names of the enumerable properties of this JavaScript object, including the properties from the prototype objects.
Link copied to clipboard
public abstract boolean putProperty(String name, @Nullable() Object value)
Creates a new property with the given name or updates the existing one in the current JavaScript object and returns true if the property with the given name was created or updated successfully.
Link copied to clipboard
public abstract boolean removeProperty(String name)
Removes a property with the given name in the JavaScript object and returns true if the property was successfully removed.
Link copied to clipboard
public abstract JsMap set(Object key, Object value)
Associates the specified key with the specified value.
Link copied to clipboard
public abstract long size()
Returns the number of key-value mappings in this map.
Link copied to clipboard
public abstract Map<Object, Object> toMap()
Converts this map to a Map.
public abstract Map<K, V> toMap<K, V>(Class<K> keyType, Class<V> valueType)
Converts this map to a Map.